package com.yzz.hzraisedust.hzraseidust.modelbean;

import com.yzz.hzraisedust.hzraseidust.R;
import com.yzz.hzraisedust.hzraseidust.util.AirQualityUtil;

/**
 * Created by zhengzhen on 2017/8/21.
 */

public class PmDetailItemBean {
    private String updatetime;
    private float pm10;
    private float noise;
    private float pm2_5;

    private int  backgroudColor;
    private int pm2_5BackgroudColor;

    public float getPm2_5() {
        return pm2_5;
    }

    public int getBackgroudColor() {
        return backgroudColor;
    }

    private String pmDescribe;

    public String getPmDescribe() {
        return pmDescribe;
    }

    private int noiseBakcgroudColor;

    public int getNoiseBakcgroudColor() {
        return noiseBakcgroudColor;
    }

    public String getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(String updatetime) {
        this.updatetime = updatetime;
    }

    public float getPm10() {
        return pm10;
    }

    public void setPm10(float pm10) {
        this.pm10 = pm10;
    }

    public float getNoise() {
        return noise;
    }

    public void setNoise(float noise) {
        this.noise = noise;
    }

    public  void concute(){
        if(pm10 > AirQualityUtil.WORSET_AIR){
            backgroudColor = AirQualityUtil.WORSET_COLOR;
            pmDescribe = "严重污染:"+pm10;
        }else if(pm10 > AirQualityUtil.SERIOURS_AIR){
            backgroudColor = AirQualityUtil.WORSE_COLOR;
            pmDescribe = "重度污染:"+pm10;
        }else if(pm10 >AirQualityUtil.WRNING_AIR){
            backgroudColor = AirQualityUtil.MIDDLE_WORSE_COLOR;
            pmDescribe = "中度污染:"+pm10;
        }else if(pm10 > AirQualityUtil.BETTER_AIR){
            backgroudColor = AirQualityUtil.LITTLE_WORSE_COLOR;
            pmDescribe = "轻度污染:"+pm10;
        }else if(pm10 > AirQualityUtil.BEST_AIR){
            backgroudColor = AirQualityUtil.NORMAL_COLOR;
            pmDescribe = "良:"+pm10;
        }else if(pm10 >0){
            backgroudColor = AirQualityUtil.GOOD_COLOR;
            pmDescribe = "优:"+pm10;
        }else{
            backgroudColor = AirQualityUtil.OFFLINE_COLOR;
            pmDescribe = "暂无";
        }
        contuteNoise();
    }

     void contuteNoise(){
        if(noise > AirQualityUtil.NOISE_WOREST){
            noiseBakcgroudColor = AirQualityUtil.NOISE_WORSEST;
        }else if(noise > AirQualityUtil.NOISE_WORSE){
            noiseBakcgroudColor = AirQualityUtil.NORMAL_COLOR;
        }else{
            noiseBakcgroudColor = AirQualityUtil.GOOD_COLOR;
        }


    }
    private void countPm2_5(){
         if(pm2_5 > AirQualityUtil.PM2_5_WORSET_AIR){
             pm2_5BackgroudColor = AirQualityUtil.WORSE_COLOR;
         }else if(pm2_5 > AirQualityUtil.PM2_5_SERIOURS_AIR) {
             pm2_5BackgroudColor = AirQualityUtil.MIDDLE_WORSE_COLOR;
         }else if(pm2_5 > AirQualityUtil.PM2_5_WRNING_AIR){
             pm2_5BackgroudColor = AirQualityUtil.LITTLE_WORSE_COLOR;
         }else if(pm2_5 > AirQualityUtil.PM2_5_BETTER_AIR){
             pm2_5BackgroudColor = AirQualityUtil.NORMAL_COLOR;
         }else if(pm2_5 > AirQualityUtil.PM2_5_BEST_AIR){
             pm2_5BackgroudColor = AirQualityUtil.GOOD_COLOR;
         }
    }
}
